home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11084 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.4 KB  |  60 lines

  1. Newsgroups: comp.programming,comp.lang.c
  2. Path: lazrus.cca.rockwell.com!news
  3. From: Erik Vigmostad <ebvigmo@fairfield.com>
  4. Subject: Re: need help with serial communication using c++
  5. X-Nntp-Posting-Host: pcff02.cca.rockwell.com
  6. Content-Type: text/plain; charset=us-ascii
  7. Message-ID: <3151BF67.5264@fairfield.com>
  8. Sender: news@lazrus.cca.rockwell.com
  9. Content-Transfer-Encoding: 7bit
  10. Organization: Donatech
  11. References: <DoLBFr.Hvp@seas.ucla.edu> <3150CB28.1CE3@airmail.net>
  12. Mime-Version: 1.0
  13. Date: Thu, 21 Mar 1996 20:43:19 GMT
  14. X-Mailer: Mozilla 2.0 (Win95; I)
  15.  
  16. Mark Nelson wrote:
  17. > Daniel D Shin wrote:
  18. > >
  19. > > Can someone out there help me how to write serial communication program using c language?  Specifically, I need to translate a qbasic 
  20. program into c.  The ba
  21. > >
  22. > >       OPEN "COM1:9600,e,7,1,CS,DS" FOR RANDOM AS #1
  23. > >       PRINT #1, "CH",cn
  24. > >       INPUT #1, dummy
  25. > >       CLOSE #1
  26. > >
  27. > > The program must run under DOS environment.
  28. > > Thank you for your time, and any help would be greatly appreciated.
  29. > >
  30. > > shin@seas.ucla.edu
  31. > Microsoft put serial drivers in their versions of BASIC, which was
  32. > a nice thing to do.  Then, they pretty much left them out of the
  33. > O/S, which wasn't nice.  So you really can't do a direct translation
  34. > of this QBASIC code into C or C++.  (Note: they put the serial drivers
  35. > into MS Windows, so you can do this translation, sort of.  The rest
  36. > of this message applies to MS-DOS only.)
  37. > To talk to the serial ports, particularly for input, you are going to
  38. > need a set of routines that perform interrupt driven communications.
  39. > You can buy a commercial library, find a shareware library, or just
  40. > pull some code into your program.
  41. > If you just want some simple code to add to your program, you can find
  42. > it accompanying a magazine article on my home page.  Follow the links
  43. > to Articles and look for "Servicing COM Port Interrupts", which ran
  44. > in 1990.
  45. > If you want to know more, there is at least one other article on serial
  46. > communications there.  You can also follow the links to my book, "Serial
  47. > Communications: A C++ Developer's Guide," if you want more depth.
  48. > Mark Nelson
  49. > http://web2.airmail.net/marknDownload my shareware program "async30b.zip" from SimTel\msdos\c. If you 
  50. use Microsoft, download async30m.zip.  Any questions, call 515-472-7820. 
  51.  I include the source and all memory models if you register ($45).
  52.  
  53. Erik Vigmostad
  54.